import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/Home',
    name: 'Home',
    component: () => import('../views/Home.vue'),
    redirect: '/Welcome',
    children: [
      {
        path: '/Welcome',
        name: 'Welcome',
        component: () => import('../views/Welcome.vue')
      },
      {
        path: '/Admin',
        name: 'admin',
        component: () => import('../views/admin/List.vue')
      },
      {
        path: '/Role',
        name: 'Role',
        component: () => import('../views/role/List.vue')
      }
    ]
  },
  {
    path: '/Login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  }
]

const router = new VueRouter({
  routes
})

router.beforeEach((to, from, next) => {
  /* must call `next` */
  next()
})

export default router
